const lang = { type: 'lang', state: 'zh_CN' }

const createReducer = (actions = { lang }) => {
  const result = {}

  for (const key in actions) {
    const type = actions[key].type
    const initialState = actions[key].state

    result[key] = (state = initialState, action) => {
      if (action.type == type) {
        return action.state
      }
      return state
    }
  }

  return result
}

export default createReducer